#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>

int main()
{
    pid_t id = fork();
    if (id == 0)
    {
        int count = 5;
        while (count--)
        {
            printf("我是子进程，id: %d\n", getpid());
            sleep(1);
        }
        printf("子进程结束了\n");
        exit(1);
    }
    else
    {
        while (1)
        {
            printf("我是父进程, id: %d\n", getpid());
            sleep(1);
        }
    }


    return 0;
}
